package com.gxa.modules.sys.service.impl;

import com.gxa.common.utils.PageUtils;
import com.gxa.common.utils.Query;
import com.gxa.modules.sys.dto.MyOrderDto;
import com.gxa.modules.sys.dto.OrderManagementDto;
import com.gxa.modules.sys.entity.RestTime;
import com.gxa.modules.sys.mapper.MyOrderMapper;
import com.gxa.modules.sys.mapper.OrderSeatMapper;
import com.gxa.modules.sys.service.MyOrderService;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
@Service

public class MyOrderServiceImpl implements MyOrderService {

    @Autowired
    private MyOrderMapper myorderMapper;

    @Autowired
    private OrderSeatMapper orderSeatMapper;

    @Override
    public List<OrderManagementDto> queryByPage(OrderManagementDto orderManagementDto) {

        List<OrderManagementDto> myOrderDtos = this.myorderMapper.queryAll(orderManagementDto);

        return myOrderDtos;
    }

    @Override
    public List<OrderManagementDto> queryMyOrderList(Map<String,Object> params) {
        List<OrderManagementDto> orderManagementDtos = this.myorderMapper.queryMyOrderList(params);
        for (int i = 0; i < orderManagementDtos.size(); i++) {
            Integer orderId = orderManagementDtos.get(i).getOrderId();
            List<Integer> integers = orderSeatMapper.queryBids(orderId);
            orderManagementDtos.get(i).setBids(integers);
        }
        return orderManagementDtos;
    }

    @Override
    public void updateState(MyOrderDto myOrderDto) {
        this.myorderMapper.updateState(myOrderDto);
    }

//    @Override
//    public void updateBusinessTime(RestTime restTime) {
//        this.restTimeMapper.updateBusinessTime(restTime);
//    }

}
